package cn.zhou.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Controller
public class ModelTest {
    @RequestMapping("/demo")
    public String test(HttpServletRequest request, HttpServletResponse response){
        String id = request.getSession().getId();
        System.out.println(id);
        return "demo";
    }

    /***
     * 需要把视图解析器注释
     * @param model
     * @return
     */
    @RequestMapping("/redirect")
    public String test02(Model model){

        model.addAttribute("msg","转发测试");
        return "redirect:redirect.jsp";
    }

}
